<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<title>申请借款</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<link href="/resources/css/base.css" rel="stylesheet"
	type="text/css" />
<link href="/resources/js/miniui/themes/default/miniui.css"
	rel="stylesheet" type="text/css" />
<script src="/resources/js/jquery-1.6.2.min.js"
	type="text/javascript"></script>
<script src="/resources/js/miniui/miniui.js"
	type="text/javascript"></script>
</head>
<body>
	<h1>申请借款</h1>

	<div id="editform" class="form">
		<input class="mini-hidden" name="id" value="0" />
		<table style="width: 100%;">
			<tr>
				<td style="width: 30%; text-align: right;">借款人手机号：</td>
				<td style="width: 70%; text-align: left;">
					<input type="text" id="phone" style="width: 146px;height: 18px;"/>
				</td>
			</tr>
			<tr>
				<td style="width: 30%; text-align: right;">借款金额：</td>
				<td style="width: 70%; text-align: left;">
					<input type="text" id="money" style="width: 146px;height: 18px;"/>
				</td>
			</tr>
			<tr>
				<td style="width: 30%; text-align: right;">借款期限：</td>
				<td style="width: 70%; text-align: left;">
					<select id="deadline" style="width: 150px;height: 25px;">
						<option value="1">1个月</option>
						<option value="3">3个月</option>
						<option value="6">6个月</option>
						<option value="9">9个月</option>
						<option value="12">12个月</option>
					</select>
				</td>
			</tr>
			<tr>
				<td style="width: 30%; text-align: right;"></td>
				<td
					style="width: 70%; text-align: left; padding-top: 5px; padding-right: 20px;"
					colspan="6"><a class="mini-button saveRow"
					img="/resources/js/miniui/themes/icons/save.gif">申请</a></td>
			</tr>

		</table>
	</div>

</body>
<script type="text/javascript">
	$(function() {

		mini.parse();
		var form = new mini.Form("editform");

		$('.saveRow').bind('click', function saveRow() {
			
			var json = {
					"phone":$("#phone").val(),
					"money":$("#money").val(),
					"deadline":$("#deadline").find("option:selected").val()
				};
			console.log(json);
			$.ajax({
				url : "/borrow/apply",
				data : json,
				type : "post",
				success : function(text) {
					mini.alert("申请成功!");
				},
				error : function(jqXHR, textStatus, errorThrown) {
					alert(jqXHR.responseText);
				}
			});
		})

	})
</script>

</html>
